<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

<h:head></h:head> 
<body> 
	<h:form>
		<p:panelGrid columns="2">
			<h:outputLabel value="Title" />
			<p:inputText value="#{bookController.book.title}" />
			<h:outputLabel value="Price" />
			<p:inputText value="#{bookController.book.price}" />
			<h:outputLabel value="Author name" />
			<p:inputText value="#{bookController.book.author}" />
			<h:outputLabel value="Publication date" />
			<p:inputText value="#{bookController.book.publicationDate}">
				<f:convertDateTime pattern="d/M/yyyy" />
		</p:inputText>
		<p:commandButton action="#{bookController.save()}" value="Save" />
		</p:panelGrid>
		
		<br/>
		<h:dataTable value="#{bookController.books}" var="book">
		<h:column>
			<f:facet name="header">Title</f:facet>
			#{book.title}
		</h:column>
		<h:column>
			<f:facet name="header">Price</f:facet>
			#{book.price}
		</h:column>
		<h:column>
			<f:facet name="header">Author Name</f:facet>
			#{book.author}
		</h:column>
		<h:column>
			<f:facet name="header">Publication Date</f:facet>
			#{book.publicationDate}
		</h:column>
		</h:dataTable>
	</h:form>
</body> 
</html>
